import {reactive} from "vue";
import type {Order} from "@/types/order";

const state = reactive<{
    loading: boolean;
    finished: boolean;
    refreshing: boolean;
    list: Order.Data[];
    pagination: Order.Pagination;
    page: number;
    status: number;
    include: string;
}>({
    loading: false,
    finished: false,
    refreshing: false,
    list: [],
    pagination: {},
    page: 1,
    status: 2,
    include: "orderDetails.goods"
});

const detailState = reactive({
    orderNo: "", // 订单ID
    detail: {
        // 订单详情
        orderDetails: {
            data: [],
        },
        status: 0, // 初始状态为0
    },
    showPay: false,
    aliyun: "",
    wechat: "",
});

const createState = reactive({
    // 生成一个订单号
    cartList: [],
    address: {},
    showPay: false,
    orderNo: "",
    aliyun: "",
    wechat: "",
})

export {state,detailState,createState};